package com.micro.ai.auth.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 登录日志实体类
 * 
 * @author micro-ai
 * @since 0.0.1
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("login_logs")
@Schema(description = "登录日志")
public class LoginLog implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "日志ID")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;

    @Schema(description = "用户ID")
    private String userId;

    @Schema(description = "租户ID")
    private String tenantId;

    @Schema(description = "用户名")
    private String username;

    @Schema(description = "登录方式：password-密码, sms-短信, oauth-OAuth, social-社交")
    private String loginType;

    @Schema(description = "登录状态：success-成功, failed-失败, blocked-被阻止")
    private String status;

    @Schema(description = "失败原因")
    private String failureReason;

    @Schema(description = "IP地址")
    private String ipAddress;

    @Schema(description = "User-Agent")
    private String userAgent;

    @Schema(description = "设备ID")
    private String deviceId;

    @Schema(description = "设备名称")
    private String deviceName;

    @Schema(description = "设备类型")
    private String deviceType;

    @Schema(description = "登录位置")
    private String location;

    @Schema(description = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createdAt;
}

